﻿//using System;
//using System.Collections.Generic;
//using System.Diagnostics;
//using System.IO;
//using System.Linq;
//using System.Text;
//using System.Text.RegularExpressions;

//namespace zielonka.co.uk.extensions.system
//{
//    /*
//        Description:	
//Send any file to the recycle bin:

//You have to include the Microsoft.VisualBasic reference
//use the using Microsoft.VisualBasic.FileIO;
//Example:

//new FileInfo("C:\image.jpg").Recycle();
//Or

//// let user have a chance to cancel send to recycle bin.
//new FileInfo("C:\image.jpg").Recycle(true);
//     */

//    public static partial class FileInfoExtensions
//    {
//        /// <summary>
//        /// Send this file to the Recycle Bin
//        /// </summary>
//        /// <exception cref="File doesn't exist" />
//        /// <param name="value"></param>
//        public static void Recycle(this FileInfo value)
//        {
//            value.Recycle(false);
//        }

//        /// <summary>
//        /// Send this file to the Recycle Bin
//        /// On show, if person refuses to send file to the recycle bin, 
//        /// exception is thrown or otherwise delete fails
//        /// </summary>
//        /// <exception cref="File doesn't exist" />
//        /// <exception cref="On show, if user refuses, throws exception 'The operation was canceled.'" />
//        /// <param name="value">File being recycled</param>
//        /// <param name="showDialog">true to show pop-up</param>
//        public static void Recycle(this FileInfo value, bool showDialog)
//        {
//            if (!value.Exists)
//                throw new FileNotFoundException("File doesn't exist");
//            if (showDialog)
//                FileSystem.DeleteFile
//                    (value.FullName, UIOption.AllDialogs,
//                    RecycleOption.SendToRecycleBin);
//            else
//                FileSystem.DeleteFile
//                    (value.FullName, UIOption.OnlyErrorDialogs,
//                    RecycleOption.SendToRecycleBin);
//        }
//    }
//}
